package com.songshuai.sales.client.service.impl;

import com.songshuai.sales.client.feign.PanguApiClient;
import com.songshuai.sales.client.service.SaleServiceItemService;
import com.songshuai.webapi.baseapi.dto.pangu.request.service.AddInviteServiceItemReqDto;
import com.songshuai.webapi.baseapi.dto.pangu.request.service.ServiceReqDto;
import com.songshuai.webapi.baseapi.dto.pangu.response.service.InviteServiceItemTreeResDto;
import com.songshuai.webapi.baseapi.enumerations.ResultStatus;
import com.songshuai.webapi.baseapi.pojo.QueryResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: lhx
 * @Date: 2019/4/11 14:31
 */
@Service
public class SaleServiceItemServiceImpl implements SaleServiceItemService {



    @Autowired
    private PanguApiClient panguApiClient;


    /**
     * 查询服务标准化列表
     * @return
     */
    @Override
    public QueryResponse<List<InviteServiceItemTreeResDto>> getAllServiceList() {
        QueryResponse<List<InviteServiceItemTreeResDto>> listQueryResponse = panguApiClient.getAllServiceList();
        if (null != listQueryResponse){
            return listQueryResponse;
        }
        return new QueryResponse<>(ResultStatus.ERROR_SEARCH_FAILED);
    }


    /**
     * 获取邀约服务已反馈信息
     * @param reqDto
     * @return
     */
    @Override
    public QueryResponse<List<String>> getInviteServiceItems(ServiceReqDto reqDto) {
        QueryResponse<List<String>> inviteServiceItems = panguApiClient.getInviteServiceItems(reqDto);
        if (null != inviteServiceItems){
            return inviteServiceItems;
        }
        return new QueryResponse<>(ResultStatus.ERROR_SEARCH_FAILED);
    }


    /**
     * 新增邀约服务反馈信息
     * @param reqDto
     * @return
     */
    @Override
    public QueryResponse<Boolean> addInviteServiceItem(AddInviteServiceItemReqDto reqDto) {
        QueryResponse<Boolean> booleanQueryResponse = panguApiClient.addInviteServiceItem(reqDto);
        if (null != booleanQueryResponse){
            return booleanQueryResponse;
        }
        return new QueryResponse<>(ResultStatus.ERROR_CREATE_FAILED);
    }


}
